//
//  UIButton+AD.swift
//  ADKit
//
//  Created by Adoma on 2023/12/26.
//

import UIKit

extension UIButton {
    
    public convenience init(title: String? = nil, font: UIFont? = nil, color: UIColor? = nil) {
        self.init(type: .custom)
        self.setTitle(title, for: .normal)
        self.setTitleColor(color, for: .normal)
        self.titleLabel?.font = font
    }
    
    public convenience init(image: UIImage? = nil, selected: UIImage? = nil) {
        self.init(type: .custom)
        self.setImage(image, for: .normal)
        self.setImage(image, for: [.normal, .highlighted])
        self.setImage(selected, for: .selected)
        self.setImage(selected, for: [.selected, .highlighted])
    }
    
    public convenience init(background: UIImage? = nil, selected: UIImage? = nil) {
        self.init(type: .custom)
        self.setBackgroundImage(background, for: .normal)
        self.setBackgroundImage(background, for: [.normal, .highlighted])
        self.setBackgroundImage(selected, for: .selected)
        self.setBackgroundImage(selected, for: [.selected, .highlighted])
    }
    
}
